Skip to content

test(travis-cli): migrate tests from ava to jest #910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 27, 2020

Conversation

armano2
Copy link
Contributor

@armano2 armano2 commented Jan 26, 2020

migrate travis-cli tests from ava to jest

Description

Most of travis-cli tests are commented out, i enabled / fixed some of them,

Should i update commented one to or should i remove it?
i will prefer that they can be enabled, but instead of cloning actual repo we could mock it up

How Has This Been Tested?

Unrelated

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@byCedric
Copy link
Member

You are awesome and unstoppable! 🚀 If you can, and like to do so, you can enable them and try to fix them. It's ok if you can't solve them, I put this one and other CI vendors on the roadmap for v9 (I just wrote the draft, still want to check with Mario and Hannes before publishing it)

Does the git fixture work for Travis here? Or do you need to do a lot of commit hash fetching etc?

@armano2
Copy link
Contributor Author

armano2 commented Jan 27, 2020

i did some changes to how mocking of git is working to get it working,
note: those tests was not enabled since 2017, and commands changed a lot.

@@ -5,7 +5,7 @@ import {merge} from 'lodash';
import * as sander from 'sander';
import stream from 'string-to-stream';

const bin = path.normalize(path.join(__dirname, '../lib/cli.js'));
const bin = require.resolve('../lib/cli.js');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small update here, this is a little cleaner way to get correct path for all env

@@ -77,7 +77,7 @@ async function lint(args, options) {
}

async function log(hash) {
const result = await execa('git', [
const result = await execa(GIT, [
Copy link
Contributor Author

@armano2 armano2 Jan 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while doing tests, i found this bug, 'git' command was called directly instead of GIT variable

// Allow to override used bins for testing purposes
const GIT = process.env.TRAVIS_COMMITLINT_GIT_BIN || 'git';

console.log(process.argv);

const args = process.argv;
args.shift(); // remove node
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't want to output node as arg as its just making issues, and it let me remove witch from tests

args.shift(); // remove node
console.log(
args.map((item, index) => {
return index === 0 ? 'commitlint' : item;
Copy link
Contributor Author

@armano2 armano2 Jan 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this solves command test result being system depended

@byCedric
Copy link
Member

We are getting there 🚀 ❤️

@byCedric byCedric merged commit f3af938 into conventional-changelog:master Jan 27, 2020
@armano2 armano2 deleted the travis-ci-test branch January 27, 2020 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants